/**
 * 
 */
package dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import dao.IBillDAO;
import beans.Bill;
//import util.db.Database;

/**
 * @author jack
 *
 */
public class BillDAOImpl implements IBillDAO {

	private Connection connection;

    private List bills; 
	
	public BillDAOImpl() {
		bills = new ArrayList();
//		try {
//			connection = Database.getConnection();
//		} catch (SQLException sqle) {
//			sqle.printStackTrace();
//		}
	}
	
	public Connection getConnection() throws Exception {
		return connection;
	}

	public void setConnection(Connection connection) throws Exception {
		this.connection = connection;
	}
	
	/* (non-Javadoc)
	 * @see chap2.dao.UserDAO#addUser(chap2.vo.User)
	 */
	public void addBill(Bill bill) throws Exception {
		PreparedStatement ps = null;
		
		try {
			this.bills.add(bill);
		}
		catch(Exception e){
			throw e;
		}
		finally{
		}

	}

	/* (non-Javadoc)
	 * @see chap2.dao.BillDAO#getBill(java.lang.String)
	 */
	public Bill getBill(String uid) throws Exception {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try{
			Iterator<Bill> itr = bills.iterator();
			while (itr.hasNext()) {
				Bill bill = itr.next();
				//bill = (Bill)iterator.next();
				//if(bill.getAUTOID().equals(uid)){
				//	return bill;
				//}
			}
		}
		catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		finally{
			//closeStatement(ps);
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see chap2.dao.BillDAO#findAllBill()
	 */
	public List findAllBill() throws Exception {
		return this.bills;
	}

	@Override
	public void delete(Bill entity) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Bill get(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void save(Bill entity) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(Bill entity) {
		// TODO Auto-generated method stub
		
	}
	
}
